<?php
/**
*
* @author Blackpawn blackpawn666@hotmail.com - http://blackpawnsarchives.net
* @co_author GameCharmer admin@gamecharmer.com - http://gaming.gamecharmer.com
* @package Age of Dragons Mod :: ( Game Console Required )
* @version $Id: page_header.php 1.1.1 12-26-2009 Blackpawn
* @copyright (c) 2009 Blackpawns Archives
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
// Fetch kingdom data
$king = fetch_kingdom_data($user_id);
$admin_access = $king['admin_access'];

// Build News Tab
if($news_page){
	$tabs = '
	<td class="game_row1" align="center" width="8%" style="border-right : 1px solid Black; text-align:center;">
		<a href="index.php" class="stext"><b>'.$user->lang['NEWS'].'</b></a>
	</td>';
}else{
	$tabs = '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="index.php" class="stext"><b>'.$user->lang['NEWS'].'</b></a>
	</td>';
}

// Build Kingdom Tab
if($kingdom_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="kingdom.php" class="stext"><b>'.$user->lang['KINGDOM'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="kingdom.php" class="stext"><b>'.$user->lang['KINGDOM'].'</b></a>
	</td>';
}

// Build Barracks Tab
if($barracks_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="barracks.php" class="stext"><b>'.$user->lang['BARRACKS'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="barracks.php" class="stext"><b>'.$user->lang['BARRACKS'].'</b></a>
	</td>';
}

// Build Land Tab
if($land_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="land.php" class="stext"><b>'.$user->lang['LAND'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="land.php" class="stext"><b>'.$user->lang['LAND'].'</b></a>
	</td>';
}

// Build War Tab
if($war_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="war.php" class="stext"><b>'.$user->lang['WAR'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="war.php" class="stext"><b>'.$user->lang['WAR'].'</b></a>
	</td>';
}

// Build Market Tab
if($market_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="market.php" class="stext"><b>'.$user->lang['MARKET'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="market.php" class="stext"><b>'.$user->lang['MARKET'].'</b></a>
	</td>';
}

// Build Shop Tab
if($shop_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="shop.php" class="stext"><b>'.$user->lang['SHOP'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="shop.php" class="stext"><b>'.$user->lang['SHOP'].'</b></a>
	</td>';
}

// Build Quests Tab
if($quests_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="quests.php" class="stext"><b>'.$user->lang['QUESTS'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="quests.php" class="stext"><b>'.$user->lang['QUESTS'].'</b></a>
	</td>';
}

// Build Guide Tab
if($guide_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="guide.php" class="stext"><b>'.$user->lang['GUIDE'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="guide.php" class="stext"><b>'.$user->lang['GUIDE'].'</b></a>
	</td>';
}

// Build Ranks Tab
if($ranks_page){
	$tabs .= '
	<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; border-right : 1px solid Black; text-align:center;">
		<a href="ranks.php" class="stext"><b>'.$user->lang['RANKING'].'</b></a>
	</td>';
}else{
	$tabs .= '
	<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
		<a href="ranks.php" class="stext"><b>'.$user->lang['RANKING'].'</b></a>
	</td>';
}

if($admin_page)
{
	if($admin){
		$tabs .= '
		<td class="game_row1" align="center" width="8%" style="border-left : 1px solid Black; text-align:center;">
			<a href="admincp.php" class="stext"><b>'.$user->lang['ADMIN_CP'].'</b></a>
		</td>';
	}else{
		$tabs .= '
		<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; text-align:center;">
			<b>&nbsp;</b>
		</td>';	
	}
}else{
	if($admin){
		$tabs .= '
		<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; border-right : 1px solid #3F3E1F; text-align:center;">
			<a href="admincp.php" class="stext"><b>'.$user->lang['ADMIN_CP'].'</b></a>
		</td>';
	}else{
		$tabs .= '
		<td class="game_row2" align="center" width="8%" style="border-bottom : 1px solid Black; text-align:center;">
			<b>&nbsp;</b>
		</td>';	
	}	
}

$game_menu = '<tr>'.$tabs.'</tr>';

// Display the ticks left if the round is coming to an end
if($days_left < 1)
{
	$ticks_left_display = '
	<table border="1" cellspacing="0" cellpadding="0" align="center" width="99%" class="game_ticker">
		<tr>
			<td align="center" class="game_head"><span class="ntextred"><b>'.sprintF($user->lang['TICKS_LEFT_IN_ROUND'],$ticks_left).'</b></span></td>
		</tr>
	</table>
	<br>';
}

$template->assign_vars(array(
	'TICKS_LEFT'			=> $ticks_left_display,
	'ERROR_MSGS'			=> $error_msgs,
	'BULLETIN'				=> $game_bulletin,
	'S_BULLETIN_SHOW'		=> $game_bulletin_show,
	'EXP'					=> number_format($king['kingdom_exp']),
	'LEVEL'					=> number_format($king['kingdom_level']),
	'NET'					=> number_format($king['kingdom_net']),
	'LAND'					=> number_format($king['kingdom_total_land']),
	'OFF'					=> number_format($king['kingdom_off']),
	'DEF'					=> number_format($king['kingdom_def']),	
	'FOOD'					=> number_format($king['kingdom_food']),
	'WOOD'					=> number_format($king['kingdom_wood']),
	'IRON'					=> number_format($king['kingdom_iron']),
	'GOLD'					=> number_format($king['kingdom_gold']),
	'STAMINA'				=> number_format($king['kingdom_stamina']),
	'TURNS'					=> number_format($king['kingdom_turns']),
	'STAMINA_MAX'			=> number_format($king['kingdom_stamina_max']),
	'TURNS_MAX'				=> number_format($king['kingdom_turns_max']),
	'NEWS'					=> $news,
	'GAME_MENU'				=> $game_menu,
	)
);

// Output page
$template->set_filenames(array(
	'body' => $templates_path.'page_header.html')
);			
?>